#ifndef __USER_DRAW_WAVE_H
#define __USER_DRAW_WAVE_H

#include "bsp_system.h"
typedef struct {
    uint8_t x_start;          // 波形区域起始X坐标
    uint8_t y_start;          // 波形区域起始Y坐标
    uint8_t width;            // 波形区域宽度
    uint8_t height;           // 波形区域高度
    uint8_t grid_enabled;     // 是否显示网格
} display_area_t;
// 波形绘制参数
typedef struct {
    float time_per_pixel;     // 每像素代表的时间(秒)
    float volt_per_pixel;     // 每像素代表的电压(V)
    uint8_t points_count;     // 绘制点数
    int16_t y_offset;         // Y轴零点偏移
} wave_params_t;
void signal_display_init(u8g2_t *u8g2);
void signal_display_update(u8g2_t *u8g2, wave_t *signal);
static signal_type_t detect_signal_type(wave_t *signal);
static void calculate_wave_params(wave_t *signal, wave_params_t *params);
static void draw_coordinate_system(u8g2_t *u8g2);
static void draw_signal_waveform(u8g2_t *u8g2, wave_t *signal, const wave_params_t *params);
static void draw_signal_info(u8g2_t *u8g2, wave_t *signal);
static float generate_wave_point(signal_type_t type, float phase);
void signal_display_spectrum(u8g2_t *u8g2, wave_t *signal, float *fft_data, uint16_t fft_size, float sample_rate);
//void signal_display_spectrum(u8g2_t *u8g2, wave_t *signal);
#endif